home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 098 / cstd.arc / CSTD8#5 < prev   
Encoding:
Internet Message Format  |  1985-07-28  |  2.4 KB

  1. From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>
  2.  
  3.  
  4. mod.std.c Digest            Wed, 10 Jul 85       Volume 8 : Issue   5 
  5.  
  6. Today's Topics:
  7.                         flag to fopen (2 msgs)
  8. ----------------------------------------------------------------------
  9.  
  10. Date: Thu, 4 Jul 85 13:11:14 mst
  11. From: ihnp4!arizona!wendt (Alan Wendt)
  12. Subject: flag to fopen
  13. To: ihnp4!cbosgd!std-c, wendt
  14.  
  15. > Every C compiler for another operating system has had to implement
  16. > a flag to fopen where the application programmer specifies whether
  17. > the file is a text file or a binary file.
  18.  
  19. I prefer a call which can be made on a file descriptor to do such a
  20. declaration.  This call (ie "texfile(&stdout)") can be embedded inside
  21. printf and other places and then most applications can run unchanged.
  22.  
  23. Moreover, this method allows standard input and output to be either
  24. text or binary, whereas requiring the flag on fopen pretty much
  25. forces standard I/O files to be text.
  26.  
  27. Moreover, consider maintaining a program that is to run on CP/M and UNIX.
  28. If fopen takes unique flags I have to conditionally compile every
  29. fopen call.  With a separate function call I simply define a null
  30. function for UNIX and I don't have to conditionally compile anything
  31. except that function (even if printf does no textfile calls).
  32.  
  33. Alan Wendt
  34. arizona!wendt
  35.  
  36. ------------------------------
  37.  
  38. Date: Tue, 9 Jul 85 15:11:03 edt
  39. From: mark@cbosgd.ATT.UUCP (Mark Horton)
  40. Subject: flag to fopen
  41. To: arizona!wendt@ihnp4.uucp, osd@hou2d.uucp
  42.  
  43. I was not recommending a particular way of doing it, just pointing
  44. out the need for the application to communicate to the implementation
  45. whether the file is text or not.  A modifier would probably do OK,
  46. unless some presentation protocol had to be negotiated at fopen time
  47. over a network connection.  Presumably on UNIX there might be some
  48. way to communicate this to the raw file descriptor (e.g. an ioctl)
  49. if the presentation layer is in the kernel (which it may be with
  50. System V streams.)  Your point about stdout assuming text is quite
  51. valid, I can only observe that that's the way most micro implementations
  52. seem to handle it today, perhaps they wanted to avoid another function.
  53. In any case, standardizing the method would be a win.
  54.  
  55.         Mark
  56.  
  57. ------------------------------
  58.  
  59. End of mod.std.c Digest - Wed, 10 Jul 85 19:30:10 EDT
  60. ******************************
  61.